# 文件接收
from pyspark import SparkConf,SparkContext
import os
os.environ["PYSPARK_PYTHON"] = "D:/Soft/Python/Python310/python.exe"
os.environ["HADOOP_HOME"]="D:/Soft/Python/hadoop-3.0.0"

if __name__ == '__main__':
    conf = SparkConf().setMaster("local[*]").setAppName("test")
    # conf.set("spark.default.parallelism", "1") # 仅设置1个分片，也可在生成rdd的时候指定
    sc = SparkContext(conf=conf)

    rdd1 = sc.parallelize([1,2,3,4,5],numSlices=2)
    rdd1.saveAsTextFile("E:/output1")

    rdd2=sc.parallelize([("太刀",2),("捕虫网",5),("弩",1)],1)
    rdd2.saveAsTextFile("E:/output2")

    sc.stop()